const express = require('express')

const app = express()

app.use((req, res, next) => {
    req.a = '我是req.a'
    console.log('简化版全局中间件1')
    next()
})

app.use((req, res, next) => {
    res.b = '我是res.b'
    console.log('简化版全局中间件2')
    next()
})

app.get('/home', (req, res) => {
    console.log(req.a)
    console.log(res.b)
    res.send({
        name: 'home',
        msg: '简化版全局中间件'
    })
})

app.listen(8080, () => {
    console.log('8080 running')
})